package com.uzai.console.web.fd;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.fd.fdsendjobdetail.*;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.fd.FdSendJobDetailService;
import com.uzai.console.vo.fd.fdsendjob.FdSendJobSubVo;
import com.uzai.console.vo.fd.fdsendjob.FdSendMsgVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 发送任务详情
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "发送任务详情",tags = "个人微信|发单|发送任务详情")
@ApiSort(101)
@RestController
public class FdSendJobDetailController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(FdSendJobDetailController.class);

    @Autowired
    private FdSendJobDetailService fdSendJobDetailService;

    @ApiOperation(value = "查询群发子任务列表", notes = "查询群发子任务列表", response = FdSendJobSubVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/fdSendJobDetail/findFdSendJobSubList")
    public Object findFdSendJobSubList(@RequestBody FdSendJobSubQuery fdSendJobSubQuery){
        return fdSendJobDetailService.findFdSendJobSubList(fdSendJobSubQuery);
    }

    @ApiOperation(value = "查询群发子任务详情", notes = "查询群发子任务详情", response = FdSendJobSubVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/fdSendJobDetail/findFdSendJobSub")
    public Object findFdSendJobSub(@RequestBody FdSendJobSubIdDto fdSendJobSubIdDto){
        return fdSendJobDetailService.findFdSendJobSub(fdSendJobSubIdDto);
    }

    @SystemLogType(model = SystemModelEnum.FdSendJob, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "修改群发子任务", notes = "修改群发子任务")
    @ApiOperationSupport(order = 4)
    @PostMapping("/fdSendJobDetail/updateFdSendJobSub")
    public Object updateFdSendJobSub(@RequestBody FdSendJobSubDto fdSendJobSubDto){
        fdSendJobDetailService.updateFdSendJobSub(fdSendJobSubDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.FdSendJob, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "开始群发子任务", notes = "开始群发子任务")
    @ApiOperationSupport(order = 5)
    @PostMapping("/fdSendJobDetail/startFdSendJobSub")
    public Object startFdSendJobSub(@RequestBody FdSendJobSubIdDto fdSendJobSubIdDto){
        fdSendJobDetailService.startFdSendJobSub(fdSendJobSubIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.FdSendJob, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "暂停群发子任务", notes = "暂停群发子任务")
    @ApiOperationSupport(order = 5)
    @PostMapping("/fdSendJobDetail/pauseFdSendJobSub")
    public Object pauseFdSendJobSub(@RequestBody FdSendJobSubIdDto fdSendJobSubIdDto){
        fdSendJobDetailService.pauseFdSendJobSub(fdSendJobSubIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.FdSendJob, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "结束群发子任务", notes = "结束群发子任务")
    @ApiOperationSupport(order = 6)
    @PostMapping("/fdSendJobDetail/finishFdSendJobSub")
    public Object finishFdSendJobSub(@RequestBody FdSendJobSubIdDto fdSendJobSubIdDto){
        fdSendJobDetailService.finishFdSendJobSub(fdSendJobSubIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.FdSendJob, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除群发子任务", notes = "删除群发子任务")
    @ApiOperationSupport(order = 7)
    @PostMapping("/fdSendJobDetail/deleteFdSendJobSub")
    public Object deleteFdSendJobSub(@RequestBody FdSendJobSubIdDto fdSendJobSubIdDto){
        fdSendJobDetailService.deleteFdSendJobSub(fdSendJobSubIdDto);
        return true;
    }

    @ApiOperation(value = "查询群发消息列表", notes = "查询群发消息列表", response = FdSendMsgVo.class)
    @ApiOperationSupport(order = 8)
    @PostMapping("/fdSendJobDetail/findFdSendMsgList")
    public Object findFdSendMsgList(@RequestBody FdSendMsgQuery fdSendMsgQuery){
        return fdSendJobDetailService.findFdSendMsgList(fdSendMsgQuery);
    }

    @ApiOperation(value = "查询群发子任务详情", notes = "查询群发子任务详情", response = FdSendMsgVo.class)
    @ApiOperationSupport(order = 9)
    @PostMapping("/fdSendJobDetail/findFdSendMsg")
    public Object findFdSendMsg(@RequestBody FdSendMsgIdDto fdSendMsgIdDto){
        return fdSendJobDetailService.findFdSendMsg(fdSendMsgIdDto);
    }

    @SystemLogType(model = SystemModelEnum.FdSendJob, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "修改群发消息", notes = "修改群发消息")
    @ApiOperationSupport(order = 10)
    @PostMapping("/fdSendJobDetail/updateFdSendMsg")
    public Object updateFdSendMsg(@RequestBody FdSendMsgUpdateDto fdSendMsgUpdateDto){
        fdSendJobDetailService.updateFdSendMsg(fdSendMsgUpdateDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.FdSendJob, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除群发消息", notes = "删除群发消息")
    @ApiOperationSupport(order = 11)
    @PostMapping("/fdSendJobDetail/deleteFdSendMsg")
    public Object deleteFdSendMsg(@RequestBody FdSendMsgIdDto fdSendMsgIdDto){
        fdSendJobDetailService.deleteFdSendMsg(fdSendMsgIdDto);
        return true;
    }

}
